<template>
	<view>
		<view class="title">{{artDetail.title}}</view>
		<view class="pub-time"  v-if="artDetail.createDate">发布时间：{{artDetail.createDate}}</view>
		
		<view class="art-content">
			<rich-text :nodes="artDetail.content"></rich-text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				artDetail:{} // 文章详情
			};
		},
		onLoad(option) {
			this.getArtDetail(option.id)
		},
		methods:{
			async getArtDetail(id){
				const {data:res}=await uni.$http.post('/information/getDetail',{id:id})
				console.log(res)
				this.artDetail=res.data
				this.artDetail.createDate=this.artDetail.createDate.slice(0,10)
				
				// 动态修改导航标题
				uni.setNavigationBarTitle({
				    title: res.data.title
				});
			}
		}
	}
</script>

<style lang="scss">
.title{
	height: 84rpx;
	line-height: 84rpx;
	padding-left: 27rpx;
	box-sizing: border-box;
	font-size: 36rpx;
	font-weight: bold;
	color: #111111;
}
.pub-time{
	font-size: 26rpx;
	font-weight: 400;
	color: #999999;
	padding-left: 27rpx;
	box-sizing: border-box;
	margin-bottom: 60rpx;
}

.art-content{
	font-size: 26rpx;
	font-weight: bold;
	color: #7A7A7A;
	line-height: 36rpx;
	padding: 0 24rpx;
}
</style>
